#include "head.h"

struct all_info *shm_buf;

void *refresh_handler(void *arg)
{
	printf("***************refresh_handler***************\n");
	struct all_info *shm_buf;
	int semid;
	semid = sem_init();
	shm_buf = shm_init();
	while(1)
	{
		pthread_mutex_lock(&mutex.mutex_refresh);
		pthread_cond_wait(&cond.cond_refresh,&mutex.mutex_refresh);
		pthread_mutex_lock(&mutex.mutex_global);
		sem_p(semid);
		*shm_buf = all_storage_data;
		sem_v(semid);
		pthread_mutex_unlock(&mutex.mutex_global);
		pthread_mutex_unlock(&mutex.mutex_refresh);

		printf("refresh is success\n");
	}
}
